<?php

class SystemlogController extends Controller
{
	protected $_navId = 'system';
	
	public function actionLoginActivity()
	{
		$logLogin = new LogLogin();
		$loginActivitySearchForm = new LoginActivitySearchForm();
		$postData = app()->request->getParam('LoginActivitySearchForm', null);
		if($postData){
			$loginActivitySearchForm->attributes = $postData;
		}
		
		$this->render('loginactivity', array(
			'logLogin' => $logLogin,
			'loginActivitySearchForm' => $loginActivitySearchForm,
			'sort' => app()->request->getParam('LogLogin_sort', 'time_sort.desc'),
		));
	}
	
	public function actionActionActivity()
	{
		$logAction = new LogAction();
		$actionActivitySearchForm = new ActionActivitySearchForm();
		$postData = app()->request->getParam('ActionActivitySearchForm', null);
		if($postData){
			$actionActivitySearchForm->attributes = $postData;
		}
		
		$this->render('actionactivity', array(
			'logAction' => $logAction,
			'actionActivitySearchForm' => $actionActivitySearchForm,
			'sort' => app()->request->getParam('LogAction_sort', 'time_sort.desc'),
		));
	}
	
	public function actionAdditional()
	{
		$this->render('additional', array(
			
		));
	}
	
	public function accessRules()
	{
		return array(
			array(
				'allow',
				'actions' => array('loginactivity', 'actionactivity', 'additional'),
				'expression' => 'app()->user->isLogin() && app()->user->hasManageConfigPerm()',
				'redirect' => array('default/noaccess')
			),

			array(
				'deny',	//should be 'deny', 'allow' is used to give convenient to make test
				'users' => array('*'),
				'redirect' => array('user/login')
			)
		);
	}
	

}